#include<stdio.h>
int sb(int year)
{
	if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
	{
		return year;
	}
	else
	{
		return 0;
	}

}
int main()
{
	int year = 0;
	for (year = 1000; year <= 2000; year++)
	{
		if (sb(year))
		{
			printf("%d ", year);
		}
	}
	return 0;
}